<template>
    <div class="login_container">
        <div class="login_card">
            <h3>图书管理系统</h3>
            <el-form>
                <el-form-item>
                    <el-input
                        v-model="form.account"
                        placeholder="请输入账号"
                        size="large"
                    ></el-input>
                </el-form-item>
                <el-form-item>
                    <el-input
                        v-model="form.password"
                        type="password"
                        placeholder="请输入密码"
                        size="large"
                    ></el-input>
                </el-form-item>
            </el-form>
            <el-button
                style="width: 100%; margin-top: 0.4rem"
                type="primary"
                size="large"
                @click="loginBtn"
            >
                登录
            </el-button>
        </div>
    </div>
</template>

<script lang="ts" setup>
import { user } from '@/api';
const form = ref({ account: '', password: '' });

async function loginBtn() {
    const res = await user.login(form.value);
    if (res.success) {
        console.log(res);
    }
}
</script>

<style lang="scss">
.login_container {
    height: 100%;
    width: 100%;
    background: url('@/assets/images/login_bg.jpg') no-repeat;
    background-size: 100% 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    .login_card {
        padding: 0.6rem 1rem;
        text-align: center;
        width: 4rem;
        background-color: #fff;
        border-radius: 0.2rem;
        h3 {
            color: #6b6b6b;
            margin-bottom: 0.8rem;
        }
    }
}
</style>
